function getBoxList() {
    let boxList = {};
    $.ajax({
        async: false,
        type: "get",//type可以为post也可以为get
        url: "http://localhost:3000/detail",
        dataType: "json",//这里要注意如果后台返回的数据不是json格式，那么就会进入到error:function(data){}中
        success: function (data) {
            // console.log(data)
            // boxList=data;
            boxList = data
            // alert(data)
        },
        error: function (data) {
        }
    });
    return boxList;
}

let data = getBoxList();


let btn = document.getElementsByClassName("btn");
btn[0].style.backgroundColor = "#FE6C00";


document.getElementsByClassName("content")[0].innerHTML = getDetail(data.detail[0]);

function getDetail(data) {

    let datail = `
        <div class="contentOne">
        <div class="title">${data.title}</div>
            <div class="characters">
        <div class="source">来源 :${data.source}</div>
        <div class="date">发布时间 :${data.date}</div>
            </div>
        <div class="imgOne"><img src="${data.imgSrc}"></div>
        </div>
        <div class="detailOne">${data.detailOne}</div>
        <div class="contentOne">
        <div class="imgOne"><img src="${data.imgSrc}"></div>
        </div>
        <div class="smallTitle">${data.smallTitle}</div>
        <div class="detailTwo">${data.detailTwo}</div>`
    return datail;
}
